package demo.rao.mideng.annotation;


import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class RaoMiDengRegistrar implements ImportBeanDefinitionRegistrar {
    /**
     * importingClassMetadata 就是 demo.rao.mideng.autoconfigure.RaoMiDengAutoConfiguration$MiDengBean
     */
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        /**<? RaoMiDengRegistrar有点多一举，直接在RaoMiDengAutoConfiguration @Bean一下MiDengBeanPostProcessor就ok了*/
        GenericBeanDefinition bd = new GenericBeanDefinition();
        bd.setBeanClass(demo.rao.mideng.core.MiDengBeanPostProcessor.class);
        registry.registerBeanDefinition("raoMiDengBeanPostProcessor", bd);
    }
}
